package com.ple.app.importdata;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by cov_neeg on 2016/11/16.
 */

public class MyopenHelper extends SQLiteOpenHelper {
    public MyopenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, null, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String createtable="create table seed(id integer,name string,tkw string,seedrate string,crop string)";
        String createtable1="create table manure(ID integer,name string,N string,P string,K string,type string)";
        String createtable3="create table decision(ID integer,dk string,grown string,data string,fertilizer string,manure string,decisiontype string)";
        /**
         * createtable4栽培表格
         */
        String createtable4="create table cultivate(ID integer,crop string,seed string,date string," +
                "total string,distance string,deep string,yield string,how_irr string,irr_number string,manure_number string)";
        String createtable8="create table cul_date(ID integer,operation string,date string)";//施肥时间和灌溉时间

        String createtable5="create table soildata(ID integer,lon string,lat string,N string,P string,K string,PH string,organic string,name string,DK string)";
        String createtable6="create table DK(ID integer,DK string,area string)";//地块信息
        String createtable7="create table delete_id(ID integer,tablename string)";//删除id

        db.execSQL(createtable);
        db.execSQL(createtable1);
        db.execSQL(createtable3);
        db.execSQL(createtable4);
        db.execSQL(createtable5);
        db.execSQL(createtable6);
        db.execSQL(createtable7);
        db.execSQL(createtable8);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        //String addconlum="ALTER TABLE cultivate ADD COLUMN ";

    }
}
